<template>
	<view class="">
		<u-navbar title="米粒商城" :autoBack="true" :placeholder="true"></u-navbar>

		<view class="">

			<view class="list">
				<view class="box" v-for="item in list" :key="index"
					@click="toUrl('/subPages/goodDetails1/goodDetails?flag=true&id='+item.id)">

					<view class="coupon-item-box">
						<view class="coupon-pic">
							<image class="he-img" :src="item.goods_image"></image>
						</view>
						<view class="coupon-item-con">
							<view class="coupon-item-name">
								{{item.name}}
							</view>
							<text class="coupon-item-desc">米粒最多可抵扣<!-- {{((item.mili.max_exchage)*1).toFixed(1)}} -->元</text>
						</view>
						<view class="coupon-item-operation">
							<view style="color: red;">
								<text style="font-size: 24rpx;">￥</text>
								<text style="font-size: 32rpx;font-weight: bold;">{{ parseInt(item.price)}}</text>
							</view>
							<view style="color: #B3B3B3;margin-left: 30rpx;font-size: 22rpx;">
								已售 {{item.pay_num}}
							</view>
						</view>
					</view>


				</view>
			</view>
		</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: null, //商品列表
			}
		},
		onShow() {
			this.getmiligoods();
		},

		methods: {
			// 获取积分列表
			async getmiligoods() {
				let res = await this.$api.getmiligoods()
				this.list = res.data.data
				console.log(this.list);
			},
			toUrl(url) {
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		padding: 20rpx;
		margin-top: 20rpx;
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 40rpx 20rpx;

		.box {
			overflow: hidden;
			border-radius: 12rpx;
			box-shadow: 0 8rpx 28rpx 0 rgba(189, 181, 176, 0.5);
		}

	}

	.coupon-item-box {
		background-color: white;

		&.completion-collection {
			view {
				color: #999 !important;
			}
		}



		position: relative;
		display: flex;
		// align-items: center;
		justify-content: space-between;

		border-radius: 12rpx;
		flex-direction: column;
		// background-color: lighten($base-color, 45%);

		.coupon-item-con {
			padding: 16rpx;
			// width: 316rpx;
			// margin-right: auto;
			padding-right: 20rpx;
			// height: 156rpx;
			border-right: 1px dashed #fff;
			line-height: 1;
			// font-size: $ns-font-size-base;

			text {
				color: red;
				font-size: 26rpx;
				overflow: hidden;
				// white-space: nowrap;
				// text-overflow: ellipsis;
				display: inherit;
			}
		}

		.coupon-item-operation {
			padding: 16rpx;
			display: flex;
			color: #111;
			margin-top: 10rpx;
			align-items: flex-end // color: $base-color;
				// font-size: $ns-font-size-base;
		}

		.coupon-item-name {
			color: rgba(0, 0, 0, 0.8);
			margin-top: 14rpx;
			font-size: 26rpx;
			height: 70rpx;
			// white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}

		.num {
			margin-left: 4rpx;
			margin-right: 10rpx;
			// font-size: $ns-font-size-lg + 12rpx;
			font-weight: 600;
			display: inline-block !important;
			overflow: initial !important;
		}
	}


	.coupon-pic {
		width: 100%;
		// height: 144rpx;
		// margin-right: 30rpx;

		image {
			width: 100%;
			height: 350rpx;
			// height: 144rpx;
		}
	}

	// .coupon-item-desc {
	// 	margin-top: 30rpx;
	// }
</style>